Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulation function supports multiple studies #278

Merged
merged 4 commits into from
Mar 4, 2024
Merged

Conversation

gowerc
Copy link
Collaborator

@gowerc gowerc commented Mar 1, 2024

Closes #113

Apologies lots of files ended up being edited but I promise its not as bad as it looks! Its more just a symptom that I changed the api for simulate_joint_data() and that function is unfortunately used everywhere.

I opted to making it a bit more explicit so that users now have to explicitly define groups and state which arm/study those groups belong to e.g.

    design = list(
        SimGroup(n = 50, study = "Study-1", arm = "Arm-A"),
        SimGroup(n = 50, study = "Study-1", arm = "Arm-B")
    )

The vast majority of the file changes are me then changing all the calls to meet this pattern.

Given this change I decided to update the RandomSlope model to have a separate intercept term per "study". The remainder of the file changes (mostly the Stan file changes) are simply just supporting this.

@gowerc gowerc requested a review from danielinteractive March 1, 2024 16:04
Copy link
Contributor

github-actions bot commented Mar 1, 2024

badge

Code Coverage Summary

Filename                       Stmts    Miss  Cover    Missing
---------------------------  -------  ------  -------  --------------------------------
R/brier_score.R                  166       0  100.00%
R/DataJoint.R                     76       2  97.37%   264, 270
R/DataLongitudinal.R             119       1  99.16%   245
R/DataSubject.R                   69       1  98.55%   124
R/DataSurvival.R                  77       0  100.00%
R/defaults.R                      10       6  40.00%   18-57, 84
R/generics.R                      19       1  94.74%   49
R/JointModel.R                   122       8  93.44%   142-144, 194, 198, 240, 286, 292
R/JointModelSamples.R             54       0  100.00%
R/Link.R                          55       4  92.73%   159-162
R/LinkComponent.R                 47       5  89.36%   100, 118, 132-149
R/LongitudinalGSF.R               64       0  100.00%
R/LongitudinalModel.R             35      12  65.71%   68-83
R/LongitudinalQuantities.R        85       8  90.59%   100-107
R/LongitudinalRandomSlope.R       27       0  100.00%
R/LongitudinalSteinFojo.R         57       8  85.96%   113-135
R/Parameter.R                     14       0  100.00%
R/ParameterList.R                 42       1  97.62%   184
R/Prior.R                        236       8  96.61%   480, 576, 588-606
R/Quantities.R                   105       0  100.00%
R/settings.R                      12      12  0.00%    55-69
R/simulations_gsf.R               43       0  100.00%
R/simulations_os.R                11       0  100.00%
R/simulations_rs.R                29       0  100.00%
R/simulations_sf.R                40      40  0.00%    17-109
R/simulations.R                  112       0  100.00%
R/StanModel.R                     15       0  100.00%
R/StanModule.R                   177       6  96.61%   199-200, 242, 253, 388, 416
R/SurvivalExponential.R           10       0  100.00%
R/SurvivalLoglogistic.R           11       0  100.00%
R/SurvivalModel.R                 19       0  100.00%
R/SurvivalQuantities.R           151       6  96.03%   173-178
R/SurvivalWeibullPH.R             11       0  100.00%
R/utilities.R                    145       1  99.31%   13
R/zzz.R                            2       2  0.00%    3-12
TOTAL                           2267     132  94.18%

Diff against main

Filename               Stmts    Miss  Cover
-------------------  -------  ------  --------
R/simulations_gsf.R       +2       0  +100.00%
R/simulations_rs.R        +8       0  +100.00%
R/simulations_sf.R        +2      +2  +100.00%
R/simulations.R          +11       0  +100.00%
TOTAL                    +23      +2  -0.03%

Results for commit: e95d411

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

Copy link
Contributor

github-actions bot commented Mar 1, 2024

Unit Tests Summary

  1 files   36 suites   5m 14s ⏱️
113 tests  87 ✅ 26 💤 0 ❌
810 runs  784 ✅ 26 💤 0 ❌

Results for commit e95d411.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Mar 1, 2024

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
LongitudinalRandomSlope 💔 $0.07$ $+24.31$ $+1$ $0$ $0$ $0$
misc_models 💚 $21.08$ $-20.21$ $0$ $0$ $0$ $0$
model_random_slope_2chain 💔 $37.19$ $+1.82$ $0$ $0$ $0$ $0$
stan_functions 💔 $46.57$ $+2.48$ $0$ $0$ $0$ $0$
Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
LongitudinalRandomSlope 👶 $+24.31$ LongitudinalRandomSlope_correctly_generates_an_intercept_per_study
misc_models 💚 $21.08$ $-20.21$ Longitudinal_Model_doesn_t_print_sampler_rejection_messages
model_random_slope_2chain 💔 $37.19$ $+1.82$ Can_recover_known_distribution_parameters_from_random_slope_model_when_using_multiple_chains
simulations 👶 $+0.03$ SimGroup_works_as_expected
simulations 👶 $+0.29$ simulate_joint_data_correctly_generates_an_intercept_per_study

Results for commit 2ffbcae

♻️ This comment has been updated with latest results.

R/simulations.R Outdated Show resolved Hide resolved
tests/testthat/test-simulations.R Show resolved Hide resolved
@gowerc gowerc merged commit 6cafea7 into main Mar 4, 2024
23 checks passed
@gowerc gowerc deleted the feature/sim-studies branch March 4, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update simulation function to support multiple studies
2 participants